﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication12
{
    class Program
    {
        //int CompareString(string s1, string s2)
        //{
        //    return 0;
        //}
        static void Main(string[] args)
        {
            char[] ar = { 'c', 'y', 'w', '2', '1', '6', '0' };
            int alg = 0;
            for (int i = 1; i < ar.Length; i++)
            {
                for (int j = ar.Length - i - 1; j < ar.Length - 1; j++)
                {
                    alg++;
                    if (ar[j] > ar[j + 1])
                    {
                        char tmp = ar[j];
                        ar[j] = ar[j + 1];
                        ar[j + 1] = tmp;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            Console.WriteLine("complexity: " + alg);
            foreach (var el in ar)
            {
                Console.WriteLine(el);
            }
            Console.ReadLine(); 


        }
    }
}
